<?php

class News_Page_Main_Category_Exception extends News_Page_Main_Exception {}
class News_Page_Main_Category_Invalid_Exception extends News_Page_Main_Category_Exception {}

abstract class News_Page_Main_Category extends News_Page_Main {

	protected function URL($array = array()){
		return parent::URL(array_merge(
			array('category'),
			$array
		));
	}

	public function rid($array = array()){
		return parent::rid(array_merge(
			array('category'),
			$array
		));
	}

	public static function Load($args){

		if($args['parent']->data_top() == 'add'){
			// Add News Category

		}
		if((int) $args['parent']->data_top() != 0){
			$args['id'] = (int) $args['parent']->data_top();
			$args['parent']->data_shift();
			if($args['parent']->data_top() == 'edit'){ 
				// Edit News Category
				$args['parent']->data_shift();
				CMS::File('news/page_main/category/edit');
				return News_Page_Main_Category_Edit::Load($args);
			}
			if($args['parent']->data_top() == 'delete'){ 
				// Delete News Category
			}
			if($args['parent']->data_top() == 'view'){
				$args['parent']->data_shift();
				// View News Category
				CMS::File('news/page_main/category/view');
				return News_Page_Main_Category_View::Load($args);
			}
			// View News Category
			CMS::File('news/page_main/category/view');
			return News_Page_Main_Category_View::Load($args);
		}

		throw new News_Page_Main_Category_Invalid_Exception($args);
	}


}
